%% test tool 
clc ;clear  all
%%
T = randn(3,2,2);
size_tens=size(T);
A1 = tens2mat(T,1)
A2 = tens2mat(T,2)
A3 = tens2mat(T,3)
mat2tens(A2,size_tens,2)